<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/base/base.jsp"%>
<%@ include file="/base/database.jsp" %>
	<%
		request.setCharacterEncoding("utf-8");
	
	    String leaveID=request.getParameter("leaveID");
		String courseID=request.getParameter("courseID");
		String reason=request.getParameter("reason");
		String daynum=request.getParameter("daynum");
		String stuNo=request.getParameter("stuNo");
		String applytime=request.getParameter("applytime");
		String status   =request.getParameter("status");
		String audittime=request.getParameter("audittime");
		String opinion=request.getParameter("opinion");
		
		if(status!=null){
		if("0".equals(status)){
			status="待审核";
		}
		else if("1".equals(status)){
			status="同意";
		}
		else if("2".equals(status)){
			status="不同意";
			}
		}
		
		StringBuffer sqlBuff=new StringBuffer();
		sqlBuff.append("update sys_leave set leaveID=?,courseID=?,reason=?,daynum=?,stuNo=?,applytime=?,status=?,audittime=?,opinion=? where leaveID=?");
		String sql=sqlBuff.toString();
		
		Connection conn=getConn();
		PreparedStatement pstmt=conn.prepareStatement(sql);
		
		int parameterIndex=1;
		
		pstmt.setString(parameterIndex++,leaveID);
		pstmt.setString(parameterIndex++,courseID);
		pstmt.setNString(parameterIndex++,reason);
		pstmt.setString(parameterIndex++,daynum);
		pstmt.setString(parameterIndex++,stuNo);
		pstmt.setNString(parameterIndex++,applytime);
		pstmt.setNString(parameterIndex++,status);
		pstmt.setString(parameterIndex++,audittime);
		pstmt.setNString(parameterIndex++,opinion);
		pstmt.setString(parameterIndex++,leaveID);
		
		int count=pstmt.executeUpdate();
		
		if(pstmt!=null){
			pstmt.close();
		}
		if(conn!=null){
			conn.close();
		}
	
		process(request,response,"/page/instructor/leave/leave_list.jsp");
	
	%>